<template>
  <!-- 答题卡 -->
  <div class="title">答题卡</div>
  <el-divider />
  <div v-for="(item, index) in props.titles" :key="index">
    <div class="title-name">{{ item.titleName }}</div>
    <div class="question-option">
      <span v-for="(itemSub, indexSub) in item.questions" :key="indexSub">
        <span v-if="itemSub.questionType < 4" class="symbol evaluation" @click="handleQuestionOption(itemSub)">{{ indexSub + 1 }}</span>
        <span v-if="itemSub.questionType > 3" class="symbol un-evaluation" @click="handleQuestionOption(itemSub)">{{ indexSub + 1 }}</span>
      </span>
    </div>
  </div>
</template>
<script setup>
  const props = defineProps({
    titles: {
      // 试题集合
      type: Array,
      default: () => []
    }
  })

  const emit = defineEmits(['click'])

  // 点击选项
  const handleQuestionOption = (item) => {
    emit('click', item.questionId)
  }
</script>
<style lang="scss" scoped>
  .title {
    font-size: 18px;
    text-align: center;
  }

  .title-name {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .question-option {
    margin-bottom: 30px;
    cursor: pointer;
  }

  .symbol {
    border: 1px solid #d9d9d9;
    display: inline-block;
    border-radius: 50%;
    min-width: 25px;
    height: 25px;
    line-height: 23px;
    text-align: center;
    margin-right: 10px;
    margin-bottom: 10px;
  }

  .evaluation {
    background-color: #cccccc;
    color: #fff;
  }

  .un-evaluation {
    background-color: #237cc3;
    color: #fff;
  }
</style>
